<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Location对象</title>
    <script type="text/javascript">
        alert("准备前往 百度…")
        location.href = "https://www.baidu.com"
    </script>
</head>
<body>

</body>
</html>